package com.xinqi.controller;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xinqi.bean.Follow;
import com.xinqi.common.R;
import com.xinqi.mapper.FollowMapper;
import com.xinqi.service.FollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

/**
 * @author xin麒
 * @date 2023/3/2 23:59
 */
@RestController
@RequestMapping("/follow")
public class FollowController {
    @Autowired
    private FollowService followService;
    @PutMapping("/{id}/{isFollow}/{userId}")
    public R follow(@PathVariable("id") Long followUserId
            , @PathVariable("isFollow") boolean isFollow
            ,@PathVariable("userId") Long userId){
        return followService.follow(followUserId,isFollow,userId);
    }

    @GetMapping("/or/not/{id}/{userId}")
    public R isFollow(@PathVariable("id") Long followUserId,@PathVariable("userId") Long userId){
        return followService.isFollow(followUserId,userId);
    }

    @GetMapping("/common/{id}/{userId}")
    public R followCommon(@PathVariable("id") Long id,@PathVariable("userId") Long userId){
        return followService.followCommons(id,userId);
    }
}